#include <iostream>
using namespace std;
int a[5000],m;
bool flag=false;
void kai (int,int);
int main ()
{
	int n;
	cin>>n>>m;
	for (int i=1;i<=n;i++)
		cin>>a[i];
	kai (1,n);
	return 0;
}
void kai (int top,int bot)
{
	int mid; 
	if (top<=bot)
	{
		mid=(top+bot)/2;
		if (m==a[mid])
			cout<<"YES";
		else if (m>a[mid])
			kai(mid+1,bot);
		else
			kai(top,mid-1);
	}
	else
		cout<<"NO";
}
